package com.hxd.mall.module.school.enter

import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hxd.mall.R
import com.hxd.mall.module.school.bean.ItemResource
import com.hxd.mall.utils.open.load
import com.hxd.mall.utils.open.loadRectangularImg
import com.hxd.mall.utils.open.loadRectangularImg2
import kotlinx.android.synthetic.main.home_top_fg_layout.view.*
import org.jetbrains.anko.dip
import org.jetbrains.anko.displayMetrics

/**
 * @author zhaoyong
 * @description:
 * @date :2019-10-15 17:59
 */
class ArticleListAdapter( var mWidth:Int, var mHeight:Int) :
    BaseQuickAdapter<ItemResource, BaseViewHolder>(R.layout.adapter_article_list_item_layout) {
    override fun convert(helper: BaseViewHolder?, item: ItemResource?) {
        helper!!.getView<ImageView>(R.id.iv_pic).run {
            loadRectangularImg2(item?.pictUri, R.mipmap.active_card_bg_icon, R.mipmap.active_card_bg_icon,iv =this,ivWidth = mWidth ,ivHeight = mHeight )
        }
        helper.getView<TextView>(R.id.tv_title).text = item?.title ?: ""
    }
}